
package com.hitechbangla.fctu.base.map;

import java.awt.Graphics;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class Loop implements Serializable
{
    public List<Point> pointlist = new ArrayList<Point>();
    public void add(Point p1)
    {
         pointlist.add(p1);
    }
    public void draw(Graphics g, float ratio)
    {
        Point firstPoint, secondPoint;
        if(pointlist.isEmpty()){
            return;
        }
        firstPoint = pointlist.get(0);
        //ratio = (float) .2;
        for(int i=1; i <pointlist.size() - 1; i++)
        {
            secondPoint = pointlist.get(i);
            //int firstPointPixelX = (int) (500-firstPoint.x * ratio);
            //int firstPointPixelX = (int) (firstPoint.x * ratio);
            //int firstPointPixelY = (int) (firstPoint.y * ratio);
            int firstPointPixelY = (int) (firstPoint.x * ratio);
            int firstPointPixelX = (int) (firstPoint.y * ratio);
            //int secondPointPixelX = (int) (500-secondPoint.x * ratio);
            //int secondPointPixelX = (int) (secondPoint.x * ratio);
            //int secondPointPixelY = (int) (secondPoint.y * ratio);
            int secondPointPixelY = (int) (secondPoint.x * ratio);
            int secondPointPixelX = (int) (secondPoint.y * ratio);
            
            g.drawLine(firstPointPixelX, firstPointPixelY, secondPointPixelX, secondPointPixelY);
            
           // //System.out.println("x:" +firstPointPixelX + " y : " + firstPointPixelY );
            firstPoint = secondPoint;
            //g.drawLine((int)pointlist.get(i).x,(int)pointlist.get(i).y, (int)pointlist.get(i+1).x,(int)pointlist.get(i+1).y);
        }
    }
}
